var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "fs", "path", "./createDirectory"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const fs_1 = __importDefault(require("fs"));
    const path_1 = __importDefault(require("path"));
    const createDirectory_1 = __importDefault(require("./createDirectory"));
    async function createFileAsync(filePath, data) {
        let dirPath = path_1.default.dirname(filePath) + '\\';
        (0, createDirectory_1.default)(dirPath);
        if (fs_1.default.existsSync(filePath)) {
            return false;
        }
        else {
            return new Promise((resolve, reject) => {
                fs_1.default.writeFile(filePath, data, (err) => {
                    if (err) {
                        resolve(false);
                    }
                    else {
                        resolve(true);
                    }
                });
            });
        }
    }
    exports.default = createFileAsync;
});
